import request from '@/utils/request'
const baseUrl = '/cz-rentbox/api/v1/releaseRents' // 集装箱出租

// 获取 我的租箱table
export const getTable = (data: any) => {
  return request({
    url: baseUrl+'/boxEastSelfPage',
    method: 'post',
    data: data
  })
}

//集装箱公司保存待发布
export const saveBox = (data: any) => {
  return request({
    url: baseUrl+'/boxEastTobeReleased',
    method: 'post',
    data: data
  })
}
/**
 * 集装箱公司放入仓库
 * * */
export const boxEastInWarehouse = (data: any) => {
  return request({
   url: baseUrl+'/boxEastInWarehouse',
   method: 'POST',
   data: data
  })
}
//集装箱公司提交发布
export const publishBox = (data: any) => {
  return request({
    url: baseUrl+'/boxEastSubmit',
    method: 'post',
    data: data
  })
}


/**批量删除租箱
 * @param data {id:[1,2,3]}
*/
export const deletePitch = (data: any) => {
  return request({
    url: baseUrl+'',
    method: 'DELETE',
    data: data
  })
}

/**获取发布租箱的详情
 * @param id 1
*/
export const getBoxInfo = (id: string) => {
  return request({
    url: baseUrl+'/'+ id,
    method: 'GET'
  })
}

/**获取发布租箱库存
 * @param string cityId
 * @return  {type number 集装箱箱型: 5 - 40HQ   10 - 40GP  15 - 20HQ   20 - 20GP}
 * @return  {boxCondition number 集装箱箱况: 5-全新   10-次新  15-适货}
 * @return inventory number 库存
*/
export const getBoxNum = (cityId: string) => {
  return request({
    url: baseUrl+'/'+cityId+'/inventory',
    method: 'get',
    // data: data
  })
}


/**批量上架租箱
 * @param data {id:[1,2,3]}
*/
export const publishPitch = (data: any) => {
  return request({
    url: baseUrl+'/onShelf',
    method: 'put',
    data: data
  })
}


/**批量下架租箱
 * @param data {id:[1,2,3]}
*/
export const downPitch = (data: any) => {
  return request({
    url: baseUrl+'/offShelf',
    method: 'put',
    data: data
  })
}

/**统计
 * @param rentSource 租箱来源: 5-集装箱公司发布 10-货代发布
 * @return 5-出租中 10-仓库中 15-待发布 (状态+对应数量)
*/
export const statusCount = (data: any) => {
  return request({
    url: baseUrl+'/statusCount',
    method: 'post',
    data: data
  })
}


//求租箱
/**
### 集装箱公司查询货代发布的分页列表
# POST {{baseUrl}}/releaseRent/boxEastAgentPage
# 过滤条件：累计回调租量区间:beginTotalRentQty endTotalRentQty  创建时间时间区间:beginCreateDate endCreateDate
# 提箱城市Id: carryCityId  还箱城市Id: returnCityId  箱型:boxType  箱况:boxCondition
# 发布状态:status 5-出租中 10-仓库中 15-待发布
## 分页字段必填 pageNum pageSize
 */
export const boxEastAgentPage = (data: any) => {
  return request({
    url: baseUrl+'/boxEastAgentPage',
    method: 'post',
    data: data
  //   data: {
  //   "pageNum": 1,
  //   "pageSize": 10
  //  }
  })
}

/**
### 货代查询自己发布的分页列表
# POST {{baseUrl}}/releaseRent/agentSelfPage
# 过滤条件：累计回调租量区间:beginTotalRentQty endTotalRentQty  创建时间时间区间:beginCreateDate endCreateDate
# 提箱城市Id: carryCityId  还箱城市Id: returnCityId  箱型:boxType  箱况:boxCondition
# 发布状态:status 5-出租中 10-仓库中 15-待发布
## 分页字段必填 pageNum pageSize 
 */
export const getAgentSelfPage = (data: any) => {
  return request({
    url: baseUrl+'/agentSelfPage',
    method: 'post',
    data: data
  //   data: {
  //   "pageNum": 1,
  //   "pageSize": 10
  //  }
  })
}

/**
 * 集装箱求租 提交发布
 * 发布租箱:货代提交发布(编辑增加id 传参)
 */
export const agentSubmit = (data: any) => { //立即发布
  return request({
    url: baseUrl+'/agentSubmit',
    method: 'post',
    data: data
  })
}

/**
 * 货代放入仓库
 * * */
export const agentInWarehouse = (data: any) => {
   return request({
    url: baseUrl+'/agentInWarehouse',
    method: 'POST',
    data: data
   })
}


/**
 * 集装箱求租 保存待发布
 * 发布租箱:货代保存待发布(编辑增加id 传参)
 * POST {{baseUrl}}/releaseRent/agentTobeReleased
 */
export const agentTobeReleased = (data: any) => {  //保存待发布
  return request({
    url: baseUrl+'/agentTobeReleased',
    method: 'POST',
    data: data,
  })
}